$def with (loan, book)

<div data-userid="$(loan['userid'])">
  Borrowed $datestr(datetime_from_utc_timestamp(loan['loaned_at']))
</div>
$ wlsize = book.get_waitinglist_size()
$if wlsize:
  <div>
    $ungettext("There is one person waiting for this book.", "There are %(n)s people waiting for this book.", wlsize, n=wlsize)
  </div>

<div>
    $if loan['expiry'] is None:
        $# Not yet fulfilled
        <span class="red">Not yet downloaded. </span><br/>
        <a href="$loan['loan_link']">Download Now</a>
    $else:
        $:macros.FormatExpiry(loan['expiry'])
</div>

<div class="actions">
  $if loan['resource_type'] == 'bookreader':
    $:macros.LoanReadForm(loan['ocaid'])
    $:macros.ReturnForm(loan['ocaid'])
</div>

